import request from '@/utils/request'

const baseUrl = process.env.NODE_ENV === 'production' ? '' : '/vehicleMap'

export function listCar(query) {
  return request({
    url:baseUrl+'/device/list',
    method: 'get',
    params: query
  })
}



export function chargers() {
  return request({
    url:baseUrl+ "/lcebcharger",
    method: "get",
    params: {
      
    }
  })
}

export function loadChargersApi(pageNo, pageSize) {
  return request({
    url:baseUrl+ "/lcebcharger/listLcEbChargerAll",
    method: "get",
    params: {
      pageNo: pageNo,
      pageSize: pageSize
    }
  })
}

export function addApi(form) {
  return request({
    url:baseUrl+ "/lcebcard",
    method: "post",
    data: form
  });
}

export function batchDelApi(multipleSelection) {
  let ids = new Array();
  for (let i = 0; i < multipleSelection.length; i++) {
    ids[i] = multipleSelection[i].id
  }
  return request({
    url:baseUrl+ '/lcebcharger',
    method: 'delete',
    data: ids
  });
}

export function delEBChargerApi(row){
  return request({
    url:baseUrl+"/lcebcharger/selective",
    method:"delete",
    data:{
      id : row.id
    }
  })
}


export function loadParkfieldApi() {
  return request({
    url:baseUrl+ "/lcebparkfield/listParkfieldBymanageId",
    method:"get"
  })
}

export function loadDetailApi(params) {
  return request({
    url:baseUrl+ "/lcebdepositrecord/listLcEbDepositRecordByCondition",
    method:"get",
    params:params
  })
}

export function loadRecordApi(params) {
  return request({
    url:baseUrl+ "/lcebchargerlog/listLcEbChargerLogByCond",
    method:"get",
    params:params
  })
}











export function getByMac(row) {
  return request({
    url:baseUrl+'/lcebcharger/getByMac?mac='+row.mac,
    method: 'get',
  });
}

export function plugSet(deviceNo, id, workType) {
  return request({
    url:baseUrl+ '/lcSet/plugSet?deviceNo='+deviceNo+'&plugNo='+id+'&workType='+workType,
    method: 'get',
  });
}


export function setPriceApi(editdata) {
  const data = editdata
  return request({
    url:baseUrl+'/lcSet/priceSet',
    method: 'put',
    data: data
  })
}

export function getPriceApi(row) {
  return request({
    url:baseUrl+ '/lcSet/priceQuery?deviceNo='+row.mac,
    method: 'get',
  });
}


export function loadEBCardApi(params) {
  return request({
    url:baseUrl+ "/lcebcard/listLcEbAll",
    method: "get",
    params:params
  })
}


export function rechargerApi(cardNo, amount) {
  return request({
    url:baseUrl+ "/lcebcard/depositLcEbCardRecord",
    method: "get",
    params: {
      cardNo: cardNo,
      amount: amount,
    }
  });
}

export function cancelEBCardApi(form){
  return request({
    url:baseUrl+"/lcebcard",
    method:"put",
    data: form,
  })
}

export function reportLossEBCardApi(form) {
  return request({
    url:baseUrl+ '/lcebcard',
    method: 'put',
    data: form,
  });
}


export function delApi(row){
  return request({
    url:baseUrl+"/lcebcard/selective",
    method:"delete",
    data:{
      id : row.id
    }
  })
}



















